package com.ruoyi.system.service.construction.strategy.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.system.domain.construction.strategy.ConstructionStrategyDetail;
import com.ruoyi.system.mapper.construction.strategy.ConstructionStrategyDetailMapper;
import com.ruoyi.system.service.construction.strategy.ConstructionStrategyDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 施工攻略详情Service业务层处理
 * 
 * @author zhangshaocong
 * @date 2020-12-03
 */
@Service
public class ConstructionStrategyDetailServiceImpl implements ConstructionStrategyDetailService
{
    @Autowired
    private ConstructionStrategyDetailMapper constructionStrategyDetailMapper;

    /**
     * 查询施工攻略详情
     * 
     * @param strategyDetailId 施工攻略详情ID
     * @return 施工攻略详情
     */
    @Override
    public ConstructionStrategyDetail selectConstructionStrategyDetailById(Long strategyDetailId)
    {
        return constructionStrategyDetailMapper.selectConstructionStrategyDetailById(strategyDetailId);
    }

    /**
     * 查询施工攻略详情列表
     * 
     * @param constructionStrategyDetail 施工攻略详情
     * @return 施工攻略详情
     */
    @Override
    public List<ConstructionStrategyDetail> selectConstructionStrategyDetailList(ConstructionStrategyDetail constructionStrategyDetail)
    {
        return constructionStrategyDetailMapper.selectConstructionStrategyDetailList(constructionStrategyDetail);
    }

    /**
     * 校验施工案例唯一性
     * @param constructionStrategyId
     * @return
     */
    public String checkConstructionStrategyDetailById(Long constructionStrategyId){
        int row = constructionStrategyDetailMapper.checkConstructionStrategyDetailById(constructionStrategyId);
        if (row > 0)
        {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    /**
     * 新增施工攻略详情
     * 
     * @param constructionStrategyDetail 施工攻略详情
     * @return 结果
     */
    @Override
    public int insertConstructionStrategyDetail(ConstructionStrategyDetail constructionStrategyDetail)
    {
        return constructionStrategyDetailMapper.insertConstructionStrategyDetail(constructionStrategyDetail);
    }

    /**
     * 修改施工攻略详情
     * 
     * @param constructionStrategyDetail 施工攻略详情
     * @return 结果
     */
    @Override
    public int updateConstructionStrategyDetail(ConstructionStrategyDetail constructionStrategyDetail)
    {
        return constructionStrategyDetailMapper.updateConstructionStrategyDetail(constructionStrategyDetail);
    }

    /**
     * 批量删除施工攻略详情
     * 
     * @param strategyDetailIds 需要删除的施工攻略详情ID
     * @return 结果
     */
    @Override
    public int deleteConstructionStrategyDetailByIds(Long[] strategyDetailIds)
    {
        return constructionStrategyDetailMapper.deleteConstructionStrategyDetailByIds(strategyDetailIds);
    }

    /**
     * 删除施工攻略详情信息
     * 
     * @param strategyDetailId 施工攻略详情ID
     * @return 结果
     */
    @Override
    public int deleteConstructionStrategyDetailById(Long strategyDetailId)
    {
        return constructionStrategyDetailMapper.deleteConstructionStrategyDetailById(strategyDetailId);
    }
}
